import com.beust.jcommander.JCommander;
import com.gq.utils.Crypto;


public class Main {
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		ArgumentsEnv arge = new ArgumentsEnv();
		JCommander cmd = new JCommander(arge);
		try {
			if (args.length == 0) throw new Exception();
			cmd.parse(args);			// parse the argument
			if (arge.getTextInput() != null) {
				if (arge.isEncryptLine()) {
					System.out.println(new Crypto(arge.getPwd()).encryptToBase64(arge.getTextInput()));
				} else if (arge.isDecryptLine()) {
					System.out.println(new Crypto(arge.getPwd()).decryptFromBase64(arge.getTextInput()));
				}
			}
		} catch(Exception e) {
			cmd.usage();
		}
	}

}
